CFLAGS += $(cflags-y)
+cppflags-$(CONFIG_XEN) += \
+ -D__XEN_INTERFACE_VERSION__=$(CONFIG_XEN_INTERFACE_VERSION)
+
+CPPFLAGS += $(cppflags-y)
+
# Default subarch .c files
mcore-y := mach-default
smp_mb__after_clear_bit();
stop_hz_timer();
/* Blocking includes an implicit local_irq_enable(). */
- HYPERVISOR_sched_op(SCHEDOP_block, 0);
+ HYPERVISOR_block();
start_hz_timer();
set_thread_flag(TIF_POLLING_NRFLAG);
}
static int
xen_panic_event(struct notifier_block *this, unsigned long event, void *ptr)
{
- HYPERVISOR_sched_op(SCHEDOP_shutdown, SHUTDOWN_crash);
+ HYPERVISOR_shutdown(SHUTDOWN_crash);
/* we're never actually going to get here... */
return NOTIFY_DONE;
}
endif
CFLAGS += $(cflags-y)
+
+cppflags-$(CONFIG_XEN) += \
+ -D__XEN_INTERFACE_VERSION__=$(CONFIG_XEN_INTERFACE_VERSION)
+
+CPPFLAGS += $(cppflags-y)
+
head-y := arch/ia64/kernel/head.o arch/ia64/kernel/init_task.o
libs-y += arch/ia64/lib/
cflags-$(CONFIG_MPSC) += $(call cc-option,-march=nocona)
CFLAGS += $(cflags-y)
+cppflags-$(CONFIG_XEN) += \
+ -D__XEN_INTERFACE_VERSION__=$(CONFIG_XEN_INTERFACE_VERSION)
+CPPFLAGS += $(cppflags-y)
+
CFLAGS += -m64
CFLAGS += -mno-red-zone
CFLAGS += -mcmodel=kernel
smp_mb__after_clear_bit();
stop_hz_timer();
/* Blocking includes an implicit local_irq_enable(). */
- HYPERVISOR_sched_op(SCHEDOP_block, 0);
+ HYPERVISOR_block();
start_hz_timer();
set_thread_flag(TIF_POLLING_NRFLAG);
}
static int
xen_panic_event(struct notifier_block *this, unsigned long event, void *ptr)
{
- HYPERVISOR_sched_op(SCHEDOP_shutdown, SHUTDOWN_crash);
+ HYPERVISOR_shutdown(SHUTDOWN_crash);
/* we're never actually going to get here... */
return NOTIFY_DONE;
}
help
This is the Linux Xen port.
-config NO_IDLE_HZ
- bool
- depends on XEN
- default y
-
if XEN
+config XEN_INTERFACE_VERSION
+ hex
+ default 0x00030101
+
menu "XEN"
config XEN_PRIVILEGED_GUEST
config XEN_SYSFS
tristate "Export Xen attributes in sysfs"
- depends on XEN
depends on SYSFS
default y
help
bool
default y
+config NO_IDLE_HZ
+ bool
+ default y
+
endif
{
/* We really want to get pending console data out before we die. */
xencons_force_flush();
- HYPERVISOR_sched_op(SCHEDOP_shutdown, SHUTDOWN_reboot);
+ HYPERVISOR_shutdown(SHUTDOWN_reboot);
}
void machine_restart(char * __unused)
{
/* We really want to get pending console data out before we die. */
xencons_force_flush();
- HYPERVISOR_sched_op(SCHEDOP_shutdown, SHUTDOWN_poweroff);
+ HYPERVISOR_shutdown(SHUTDOWN_poweroff);
}
int reboot_thru_bios = 0; /* for dmi_scan.c */
#ifndef __HYPERCALL_H__
#define __HYPERCALL_H__
-#include <xen/interface/xen.h>
-#include <xen/interface/sched.h>
-#include <xen/interface/nmi.h>
-#include <linux/errno.h>
+#ifndef __HYPERVISOR_H__
+# error "please don't include this file directly"
+#endif
#define __STR(x) #x
#define STR(x) __STR(x)
}
static inline int
-HYPERVISOR_sched_op(
+HYPERVISOR_sched_op_compat(
int cmd, unsigned long arg)
{
- return _hypercall2(int, sched_op, cmd, arg);
+ return _hypercall2(int, sched_op_compat, cmd, arg);
}
static inline int
-HYPERVISOR_sched_op_new(
+HYPERVISOR_sched_op(
int cmd, void *arg)
{
- return _hypercall2(int, sched_op_new, cmd, arg);
-}
-
-static inline int
-HYPERVISOR_poll(
- evtchn_port_t *ports, unsigned int nr_ports, u64 timeout)
-{
- struct sched_poll sched_poll = {
- .ports = ports,
- .nr_ports = nr_ports,
- .timeout = jiffies_to_st(timeout)
- };
-
- int rc = HYPERVISOR_sched_op_new(SCHEDOP_poll, &sched_poll);
-
- if (rc == -ENOSYS)
- rc = HYPERVISOR_sched_op(SCHEDOP_yield, 0);
-
- return rc;
+ return _hypercall2(int, sched_op, cmd, arg);
}
static inline long
HYPERVISOR_suspend(
unsigned long srec)
{
- return _hypercall3(int, sched_op, SCHEDOP_shutdown,
- SHUTDOWN_suspend, srec);
+ struct sched_shutdown sched_shutdown = {
+ .reason = SHUTDOWN_suspend
+ };
+
+ int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown,
+ &sched_shutdown, srec);
+
+ if (rc == -ENOSYS)
+ rc = _hypercall3(int, sched_op_compat, SCHEDOP_shutdown,
+ SHUTDOWN_suspend, srec);
+
+ return rc;
}
static inline int
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/version.h>
+#include <linux/errno.h>
#include <xen/interface/xen.h>
#include <xen/interface/dom0_ops.h>
+#include <xen/interface/sched.h>
+#include <xen/interface/nmi.h>
#include <asm/ptrace.h>
#include <asm/page.h>
#if defined(__i386__)
#define xen_init() (0)
+static inline int
+HYPERVISOR_yield(
+ void)
+{
+ int rc = HYPERVISOR_sched_op(SCHEDOP_yield, NULL);
+
+ if (rc == -ENOSYS)
+ rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0);
+
+ return rc;
+}
+
+static inline int
+HYPERVISOR_block(
+ void)
+{
+ int rc = HYPERVISOR_sched_op(SCHEDOP_block, NULL);
+
+ if (rc == -ENOSYS)
+ rc = HYPERVISOR_sched_op_compat(SCHEDOP_block, 0);
+
+ return rc;
+}
+
+static inline int
+HYPERVISOR_shutdown(
+ unsigned int reason)
+{
+ struct sched_shutdown sched_shutdown = {
+ .reason = reason
+ };
+
+ int rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
+
+ if (rc == -ENOSYS)
+ rc = HYPERVISOR_sched_op_compat(SCHEDOP_shutdown, reason);
+
+ return rc;
+}
+
+static inline int
+HYPERVISOR_poll(
+ evtchn_port_t *ports, unsigned int nr_ports, u64 timeout)
+{
+ struct sched_poll sched_poll = {
+ .ports = ports,
+ .nr_ports = nr_ports,
+ .timeout = jiffies_to_st(timeout)
+ };
+
+ int rc = HYPERVISOR_sched_op(SCHEDOP_poll, &sched_poll);
+
+ if (rc == -ENOSYS)
+ rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0);
+
+ return rc;
+}
+
static inline void
MULTI_update_va_mapping(
multicall_entry_t *mcl, unsigned long va,
#ifndef __HYPERCALL_H__
#define __HYPERCALL_H__
-#include <xen/interface/xen.h>
-#include <xen/interface/sched.h>
-#include <xen/interface/dom0_ops.h>
-#include <linux/errno.h>
+#ifndef __HYPERVISOR_H__
+# error "please don't include this file directly"
+#endif
/* FIXME: temp place to hold these page related macros */
#include <asm/page.h>
})
static inline int
-HYPERVISOR_sched_op(
+HYPERVISOR_sched_op_compat(
int cmd, unsigned long arg)
{
- return _hypercall2(int, sched_op, cmd, arg);
+ return _hypercall2(int, sched_op_compat, cmd, arg);
}
static inline int
-HYPERVISOR_sched_op_new(
+HYPERVISOR_sched_op(
int cmd, void *arg)
{
- return _hypercall2(int, sched_op_new, cmd, arg);
-}
-
-static inline int
-HYPERVISOR_poll(
- evtchn_port_t *ports, unsigned int nr_ports, unsigned long timeout)
-{
- struct sched_poll sched_poll = {
- .ports = ports,
- .nr_ports = nr_ports,
- .timeout = jiffies_to_st(timeout)
- };
-
- int rc = HYPERVISOR_sched_op_new(SCHEDOP_poll, &sched_poll);
-
- if (rc == -ENOSYS)
- rc = HYPERVISOR_sched_op(SCHEDOP_yield, 0);
-
- return rc;
+ return _hypercall2(int, sched_op, cmd, arg);
}
static inline long
HYPERVISOR_suspend(
unsigned long srec)
{
- return _hypercall3(int, sched_op, SCHEDOP_shutdown,
- SHUTDOWN_suspend, srec);
+ struct sched_shutdown sched_shutdown = {
+ .reason = SHUTDOWN_suspend
+ };
+
+ int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown,
+ &sched_shutdown, srec);
+
+ if (rc == -ENOSYS)
+ rc = _hypercall3(int, sched_op_compat, SCHEDOP_shutdown,
+ SHUTDOWN_suspend, srec);
+
+ return rc;
}
extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs);
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/version.h>
+#include <linux/errno.h>
#include <xen/interface/xen.h>
#include <xen/interface/dom0_ops.h>
+#include <xen/interface/sched.h>
#include <asm/ptrace.h>
#include <asm/page.h>
#include <asm/hypercall.h>
+static inline int
+HYPERVISOR_yield(
+ void)
+{
+ int rc = HYPERVISOR_sched_op(SCHEDOP_yield, NULL);
+
+ if (rc == -ENOSYS)
+ rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0);
+
+ return rc;
+}
+
+static inline int
+HYPERVISOR_block(
+ void)
+{
+ int rc = HYPERVISOR_sched_op(SCHEDOP_block, NULL);
+
+ if (rc == -ENOSYS)
+ rc = HYPERVISOR_sched_op_compat(SCHEDOP_block, 0);
+
+ return rc;
+}
+
+static inline int
+HYPERVISOR_shutdown(
+ unsigned int reason)
+{
+ struct sched_shutdown sched_shutdown = {
+ .reason = reason
+ };
+
+ int rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
+
+ if (rc == -ENOSYS)
+ rc = HYPERVISOR_sched_op_compat(SCHEDOP_shutdown, reason);
+
+ return rc;
+}
+
+static inline int
+HYPERVISOR_poll(
+ evtchn_port_t *ports, unsigned int nr_ports, u64 timeout)
+{
+ struct sched_poll sched_poll = {
+ .ports = ports,
+ .nr_ports = nr_ports,
+ .timeout = jiffies_to_st(timeout)
+ };
+
+ int rc = HYPERVISOR_sched_op(SCHEDOP_poll, &sched_poll);
+
+ if (rc == -ENOSYS)
+ rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0);
+
+ return rc;
+}
+
// for drivers/xen/privcmd/privcmd.c
#define direct_remap_pfn_range(a,b,c,d,e,f) remap_pfn_range(a,b,c,d,e)
#define pfn_to_mfn(x) (x)
#ifndef __HYPERCALL_H__
#define __HYPERCALL_H__
-#include <xen/interface/xen.h>
-#include <xen/interface/sched.h>
-#include <xen/interface/nmi.h>
-#include <linux/errno.h>
+#ifndef __HYPERVISOR_H__
+# error "please don't include this file directly"
+#endif
#define __STR(x) #x
#define STR(x) __STR(x)
}
static inline int
-HYPERVISOR_sched_op(
+HYPERVISOR_sched_op_compat(
int cmd, unsigned long arg)
{
- return _hypercall2(int, sched_op, cmd, arg);
+ return _hypercall2(int, sched_op_compat, cmd, arg);
}
static inline int
-HYPERVISOR_sched_op_new(
+HYPERVISOR_sched_op(
int cmd, void *arg)
{
- return _hypercall2(int, sched_op_new, cmd, arg);
-}
-
-static inline int
-HYPERVISOR_poll(
- evtchn_port_t *ports, unsigned int nr_ports, u64 timeout)
-{
- struct sched_poll sched_poll = {
- .ports = ports,
- .nr_ports = nr_ports,
- .timeout = jiffies_to_st(timeout)
- };
-
- int rc = HYPERVISOR_sched_op_new(SCHEDOP_poll, &sched_poll);
-
- if (rc == -ENOSYS)
- rc = HYPERVISOR_sched_op(SCHEDOP_yield, 0);
-
- return rc;
+ return _hypercall2(int, sched_op, cmd, arg);
}
static inline long
HYPERVISOR_suspend(
unsigned long srec)
{
- return _hypercall3(int, sched_op, SCHEDOP_shutdown,
- SHUTDOWN_suspend, srec);
+ struct sched_shutdown sched_shutdown = {
+ .reason = SHUTDOWN_suspend
+ };
+
+ int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown,
+ &sched_shutdown, srec);
+
+ if (rc == -ENOSYS)
+ rc = _hypercall3(int, sched_op_compat, SCHEDOP_shutdown,
+ SHUTDOWN_suspend, srec);
+
+ return rc;
}
static inline int
--- /dev/null
+/******************************************************************************
+ * xen-compat.h
+ *
+ * Guest OS interface to Xen. Compatibility layer.
+ *
+ * Copyright (c) 2006, Christian Limpach
+ */
+
+#ifndef __XEN_PUBLIC_XEN_COMPAT_H__
+#define __XEN_PUBLIC_XEN_COMPAT_H__
+
+#ifndef __XEN_INTERFACE_VERSION__
+#define __XEN_INTERFACE_VERSION__ 0x00000000
+#endif
+
+#if __XEN_INTERFACE_VERSION__ < 0x00030101
+#undef __HYPERVISOR_sched_op
+#define __HYPERVISOR_sched_op __HYPERVISOR_sched_op_compat
+#endif
+
+#endif /* __XEN_PUBLIC_XEN_COMPAT_H__ */
#define __HYPERVISOR_stack_switch 3
#define __HYPERVISOR_set_callbacks 4
#define __HYPERVISOR_fpu_taskswitch 5
-#define __HYPERVISOR_sched_op 6
+#define __HYPERVISOR_sched_op_compat 6 /* compat as of 0x00030101 */
#define __HYPERVISOR_dom0_op 7
#define __HYPERVISOR_set_debugreg 8
#define __HYPERVISOR_get_debugreg 9
#define __HYPERVISOR_mmuext_op 26
#define __HYPERVISOR_acm_op 27
#define __HYPERVISOR_nmi_op 28
-#define __HYPERVISOR_sched_op_new 29
+#define __HYPERVISOR_sched_op 29
/*
* VIRTUAL INTERRUPTS
#endif /* !__ASSEMBLY__ */
+#include "xen-compat.h"
+
#endif /* __XEN_PUBLIC_XEN_H__ */
/*